
const timeRegExp = /\[(\d{2}):(\d{2})\.(\d{2,3})\]/

export function parseLyric(lyricString) {
   const lyricStrings = lyricString.split("\n")
   const lyricInfos = []
 for (const lineString of lyricStrings) {  
   const tiemResult = timeRegExp.exec(lineString)
   if(!lineString) continue
   const minute = tiemResult[1] * 60 * 1000
   const second = tiemResult[2] * 1000
   const milllsecondTime = tiemResult[3]
   const milisecond = milllsecondTime.length === 3 ? milllsecondTime * 10 : milllsecondTime * 1
   const time = minute + second + milisecond
   
   // 2.获取歌词文
   const text = lineString.replace(timeRegExp, "") 
   lyricInfos.push({time, text})
 }

  return lyricInfos
}